package top.kaoshanji.p1ch01a.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import top.kaoshanji.p1ch01a.BraveKnight;
import top.kaoshanji.p1ch01a.Knight;
import top.kaoshanji.p1ch01a.Quest;
import top.kaoshanji.p1ch01a.SlayDragonQuest;

/**
 * 代码清单-p1ch01a-9页b：Spring提供了基于Java的配置，可作为XML的替代方案
 * 类似一个XML配置文件
 * @author kaoshanji
 * ^_^
 * create time 2025/4/22 9:58
 */
@Configuration
public class KnightConfig {

    @Bean
    public Quest quest() {
        return new SlayDragonQuest(System.out);
    }

    @Bean
    public Knight knight() {
        return new BraveKnight(quest());
    }

}
